package com.example.travelservlet.collectionScenery.controller;

import com.example.travelservlet.collectionScenery.service.CollectionSceneryService;
import com.example.travelservlet.entity.CollectionScenery;
import com.example.travelservlet.user.domain.Result;
import com.example.travelservlet.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Date;
import java.util.List;

/**
 * @author hxy
 * @date 2022/11/8 9:27
 */
@RestController
@RequestMapping("/collectionScenery")
public class CollectionSceneryController {
    @Autowired
    private CollectionSceneryService collectionSceneryService;

    /**
     *
     * @param collectionId
     * @param sceneryId
     * @return
     */
    @GetMapping("/createCollectionScenery/{collectionId}/{sceneryId}")
    public Result<CollectionScenery> createCollectionScenery(@PathVariable  String collectionId, @PathVariable String sceneryId){
        CollectionScenery collectionScenery = new CollectionScenery();
        collectionScenery.setCollectId(collectionId);
        collectionScenery.setSceneryId(sceneryId);
        collectionScenery.setCollectTime(new Date());
        CollectionScenery save = collectionSceneryService.createCollectionScenery(collectionScenery);
        return ResultUtil.success(save);

    }



}
